package day05;
import java.util.Arrays;
public class ArrayDemo {
    public static void main(String[] args) {
        int []arr=new int [10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        System.out.println("---升序---");
        Arrays.sort(arr);
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("---倒序---");
        for (int i=arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }
        System.out.println("----数组的遍历----");
        int []arrr=new int [10];
        for (int i=0;i<arr.length;i++) {
            arr[i] = (int) (Math.random() * 100);
            System.out.println(arrr[i]);
            System.out.println("-------数组的声明,初始化，访问-------");
            int[] a = new int[5];
            double[] d = new double[5];
            boolean[] b = new boolean[5];

            int[] arr1 = new int[5];
            int[] arr2 = {1, 2, 3, 4};
            int[] arr3 = new int[]{1, 2, 3, 4, 5, 6};
            int[] arr4;
            arr4 = new int[]{1, 2, 3, 4};

            int[] arr5 = new int[3];
            System.out.println("数组长度为:" + arr5.length);
            System.out.println(arr5[0]);
            arr5[0] = 1;
            arr5[1] = 2;
            arr5[2] = 3;
            System.out.println(arr5[arr5.length - 1]);

        }
    }
}
